package com.qf.consumer.controller;

import com.qf.consumer.api.ProviderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RefreshScope
public class ConsumerController {

    @Value("${version}")
    private String version;

    @Autowired
    private ProviderService providerService;

    @RequestMapping("/consume/{str}")
    public String consume(@PathVariable String str){
        return providerService.provide(str) + ", version:" +version;
    }

}
